Page({
  // 选择位置
  chooseLocation() {
    wx.getLocation({
      type: 'gcj02',
      success: (res) => {
        console.log('获取位置信息：', res)
        let { latitude, longitude } = res
        wx.chooseLocation({
          latitude,
          longitude,
          success: (res) => {
            console.log('选择位置：', res)
            let { latitude, longitude, address, name } = res
            this.setData({
              latitude,
              longitude,
              address,
              name
            })
          }
        })
      }
    })
  },
  // 拍照
  takePhoto() {
    let cameraContext = wx.createCameraContext()
    // console.log(cameraContext)
    cameraContext.takePhoto({
      quality: 'high',
      success: (res) => {
        console.log('拍照：', res)
        let { tempImagePath } = res
        this.setData({
          phone: tempImagePath
        })
      },
      fail: (err) => {
        console.log('拍照失败：', err)
      },
    })
  },
  fn() {
    wx.navigateToMiniProgram({
      // appId: 'wx91d27dbf599dff74',
      // path: 'pages/item/detail/detail?sku=1724526555',
      appId: 'wxf7a4feef22917cb6',
      path: 'packages/user/coupon/list/index?type=promocard&title=我的优惠券',
      envVersion: 'release',
      success(res) {
        console.log("跳转成功");
      }
    })
  }
})